package lambda;


import lambda.entity.User;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author LIBOFEI
 * @ClassName Test8
 * @description
 * @date 2021/11/30 14:22
 * @Version 1.0
 **/
public class Test8 {

    public static void main(String[] args) {

        List<User> UserList = new ArrayList<User>();
        UserList.add(new User(23, "male1"));
        UserList.add(new User( 25, "male2"));
        UserList.add(new User( 21, "female1"));
        UserList.add(new User( 24, "female2"));
        UserList.add(new User( 25, "male3"));
        UserList.add(new User(26, "female3"));

        List<String> fiterList = UserList.stream().filter(x -> x.getId() > 22).map(User::getName)
                .collect(Collectors.toList());
        System.out.print("id大于22的员工姓名：" + fiterList);
    }
}
